package com.twohand.admin.Config;

import com.twohand.admin.Util.CosUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class StaticConfig {
//    主要用来设置用于静态类中使用的yml配置属性
    @Value("${custom.SecretId}")
    public String SecretId;
    @Value("${custom.SecretKey}")
    public String SecretKey;
    @Value("${custom.bucket}")
    public String bucket;

    @Value("${custom.bucketOrigin}")
    public String bucketOrigin;

    @Value("${custom.cosDuration}")
    public Integer cosDuration;
    @Bean
    public int initStaticConfig(){
        CosUtil.setSecretId(this.SecretId);
        CosUtil.setSecretKey(this.SecretKey);
        CosUtil.setBucket(this.bucket);
        CosUtil.setCosDuration(this.cosDuration);
        CosUtil.setBucketOrigin(this.bucketOrigin);
//        System.out.println("-------cos test:"+CosUtil.getSecretId());
        return 0;
    }
}
